package worker

import (
	"gitee.com/jnshao/go-start/projects/crawler/engine"
)

type CrawlService struct{}

func (CrawlService) Process(r Request, res *ParserResult) error {
	request, err := DeserialzeRequest(r)
	if err != nil {
		return err
	}
	result, err := engine.Worker(request)

	if err != nil {
		return err
	}

	*res = SerialzeResult(result)

	return nil
}
